<template>
  <header>
    <el-menu
      mode="horizontal"
      class="m-menu"
      :default-active="active"
      :text-color="'#eee'"
      :background-color="'#303133'"
      :active-text-color="'#409eff'"
    >
      <el-menu-item
        v-for="item in menuConfig"
        :key="item.key"
        :index="item.key"
        @click="onClickItem"
      >
        {{item.title}}
      </el-menu-item>
    </el-menu>
  </header>

  <section>
    <router-view></router-view>
  </section>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import useMenu from './useMenu';

export default defineComponent({
  name: 'Menu',
  setup() {
    const {
      menuConfig, active, onClickItem
    } = useMenu();

    return {
      menuConfig,
      active,
      onClickItem
    };
  }
});
</script>

<style lang="scss" scoped>
header {
  .m-menu {
    background: $--color-text-primary;

    // ::v-deep(.el-menu-item) {
    //   color: $--color-primary-light-9;

    //   &.is-active {
    //     background: $--color-text-primary;
    //     color: $--color-primary;

    //     &:hover {
    //       background: $--color-text-primary;
    //       color: $--color-primary;
    //     }

    //     &:focus {
    //       background: $--color-text-primary;
    //       color: $--color-primary;
    //     }
    //   }

    //   &:not(.is-active):hover {
    //     background: $--color-text-primary;
    //     color: $--color-primary;
    //   }
    // }
  }
}

section {
  height: calc(100% - 61px);
}
</style>
